using System;
using System.Collections.Generic;

namespace Nyanimals
{
	public sealed class CAnimationManager
	{
		private static readonly CAnimationManager instance = new CAnimationManager();
		public static CAnimationManager Instance { get { return instance;}}
		
		private List<CAnimation> animationList;
		
		private CAnimationManager()
		{
			animationList = new List<CAnimation>();
		}
		
		public int AddAnimation(string szName)
		{
			int curLoc = animationList.Count;
			
			// check if already exists
			for(int animIndex = 00; animIndex < curLoc; ++animIndex)
			{
				if(animationList[animIndex].Name == szName)
				{
					return animIndex;
				}
			}
			
			// add the new animation
			string szFullPath = "/Application/Resources/Animations/" + szName;
			CAnimation anim = new CAnimation(szFullPath);
			anim.Name = szName;
			animationList.Add(anim);
			
			return curLoc;			
		}
		
		public CAnimation GetAnimation(int index)
		{
			return animationList[index];
		}
		public void GetAnimation(int index, out CAnimation animOut)
		{
			animOut = GetAnimation(index);
		}
	}
}

